﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Madrigal.Lib
{
    public class CCamera
    {
        public Vector3 vPos;
        public Matrix matView;
        public Matrix matInvView;
        public Vector3 vLookAt;
        public Vector3 vPosDest;
        public Vector3 vLookAtDest;
        public Vector3 vOffset;
        public Vector3 vOffsetDest;

        public Int32 dwCamStyle;

        public float fRotX, fRotY;
        public float fCurRotX, fCurRotY;

        public int nQuakeSec;
        public float fQuakeSize;

        public bool bLock;

        private Vector3 position;
        public Vector3 Position
        {
            get { return position; }
            set { position = value; }
        }

        public CCamera()
        {
            vPos = new Vector3(50.0f, 110.0f, 50.0f);
            vLookAt = new Vector3(vPos.X + 1.0f, 100.0f, vPos.Z + 1.0f);
            vOffset = Vector3.Zero;
            nQuakeSec = 0;
            fQuakeSize = 0.06f;
            dwCamStyle = 0;
        }

        public void Reset() { }

        public void SetQuake(int nSec, float fSize) { }

        public bool IsLock() { return bLock; }
        public void Lock() { }
        public void Unlock() { }

        public virtual void Process(GraphicsDevice graphicsDevice, float fFactor)
        {

        }

        //public virtual void Transform(GraphicsDevice graphicsDevice, CWorld world)
        //{
        //    Vector3 vTempPos = vPos;
        //    if (nQuakeSec > 0)
        //    {
        //        float x = (fQuakeSize / 2.0f) - xRandomF(fQuakeSize);
        //    }
        //}
        public virtual void ControlCamera(Int32 dwStyle) { }
    }

    public class CBackCamera : CCamera
    {
        public float fLength1, fLength2, fZoom;
        public bool bOld, bStart;

        // Version 13 Housing
        public const int CM_Normal = 0;
        public const int CM_MyRoom = 1;

        public int nCamMode;
        public bool SetCamMode(int nType) { return false; }
        // End V13 Housing

        public CBackCamera() { }

        public int GetAnglePie(float fAngle) { return -1; }
    }

    public class CFlyCamera : CCamera
    {
        float fAngle, fAngleY;

        //public CObj objTarget;
        public float fZoom;

        public CFlyCamera() { }
    }

    public class CToolCamera : CCamera
    {
        public Vector3 vVelocity;
        public float fYaw, fYawVelocity, fPitch, fPitchVelocity;
        public Matrix matOrientation;

        public CToolCamera() { }
    }
}